import request from '@/utils/request'
//设备注册 和设备列表的接口
export function getListbyPage(index, size, postdata) {
	return request({
		url: '/api/BasicTerminals/GetListByPage',
		method: 'post',
		data: {
			pageindex: index,
			pagesize: size,
			postdata: JSON.stringify(postdata)
		}
	})
}
// 设备档案是下拉
export function GetShop(value) {
	return request({
		url: '/api/BasicShops/GetTree',
		method: 'post',
		data: {
			postdata: JSON.stringify(value)
		}
	})
}
//设备档案 所属区域
export function getTree1(pdata) {
	return request({
		url: '/api/SysAreas/GetTree',
		method: 'post',
		data: {
			postdata: JSON.stringify(pdata)
		}
	})
}
export function getDetail(value) {
	return request({
		url: '/File/BasicTerminals/GetRow',
		method: 'post',
		data: {
			terminalId: value
		}
	})
}
// 设备档案的删除
export function DelDetail(value) {
	return request({
		url: '/api/BasicTerminals/DeleteRows',
		method: 'post',
		data: {
			postdata: value.join(',')
		}
	})
}


//绑定运维 的
export function setDetail1(postdata, isEdit) {
	if (isEdit) {
		return request({
			url: '/api/BasicTerminals/EditRow',
			method: 'post',
			data: postdata
		})
	} else {
		return request({
			url: '/api/BasicTerminals/AddRow',
			method: 'post',
			data: postdata
		})
	}
}
export function setTerminalsDetail(postdata) {
  return request({
    url: '/File/BasicTerminals/EditRow',
    method: 'post',
    data: postdata
  })
}
export function GetInventory(postdata) {
	return request({
		url: '/order/BizCurrentStocks/GetList',
		method: 'post',
		data: {
			postdata: postdata
		}
	})
}

// 设备状态里的运维配置
export function GetList(value) {
	return request({
		url: '/api/BasicTerminalAuxs/GetList',
		method: 'post',
		data: {
			postdata: value
		}
	})
}
// 获取运维配置和设备档案里面的类型和是设备类型的下拉请求
export function getSelectTree(value) {
	return request({
		url: '/api/SysEnumDatas/GetTree',
		method: 'post',
		data: {
			postdata: value
		}
	})
}
// 获取运维配置里面的职称的下拉请求
export function getTree(val) {
	return request({
		url: '/api/BasicJobs/GetTree',
		method: 'post',
		data: {
			postdata: JSON.stringify(val)
		}
	})
}
// 获取运维配置里面的名称的下拉请求
export function GetListByJobs(val) {
	return request({
		url: '/api/BasicUserJobs/GetListByJobs',
		method: 'post',
		data: {
			postdata: JSON.stringify(val)
		}
	})
}
// 获取运维配置里面的点击提交
export function SetDetail(postdata, isEdit) {
	if (isEdit) {
		return request({
			url: '/api/BasicTerminalAuxs/EditRow',
			method: 'post',
			data: postdata
		})
	} else {
		return request({
			url: '/api/BasicTerminalAuxs/AddRow',
			method: 'post',
			data: postdata
		})
	}
}
// 删除列表里是数据
export function delDetail(value) {
	return request({
		url: '/api/BasicTerminalAuxs/DeleteRows',
		method: 'post',
		data: {
			postdata: value.join(',')
		}
	})
}
// 设备配置页面的请求
export function deployGetList(val) {
	var datas = [{
		field: 'TerminalId',
		value: val
	}]
	return request({
		url: '/api/BasicTerminalConfigs/GetList',
		method: 'post',
		data: {
			postdata: JSON.stringify(datas)
		}
	})
}
export function EditConfig(postdata) {
	return request({
		url: '/api/BasicTerminals/EditConfig',
		method: 'post',
		data: postdata
	})
}
